#include "Unit.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Unit_classType = NULL;
VTable* Unit_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Void make() */
void Unit_make(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.make not implemented yet"));
}


/* Bool equals(Obj? that) */
Bool Unit_equals(Obj self, NullableObj that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.equals not implemented yet"));
}


/* Int hash() */
Int Unit_hash(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.hash not implemented yet"));
}


/* Str toStr() */
Str* Unit_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.toStr not implemented yet"));
}


/* Unit define(Str s) */
Unit* Unit_define(Str* s)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.define not implemented yet"));
}


/* Unit? fromStr(Str s, Bool checked) */
Unit* Unit_fromStr_1(Str* s)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.fromStr not implemented yet"));
}


/* Unit? fromStr(Str s, Bool checked) */
Unit* Unit_fromStr(Str* s, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.fromStr not implemented yet"));
}


/* Unit[] list() */
List* Unit_list(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.list not implemented yet"));
}


/* Str[] quantities() */
List* Unit_quantities(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.quantities not implemented yet"));
}


/* Unit[] quantity(Str quantity) */
List* Unit_quantity(Str* quantity)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.quantity not implemented yet"));
}


/* Str[] ids() */
List* Unit_ids(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.ids not implemented yet"));
}


/* Str name() */
Str* Unit_name(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.name not implemented yet"));
}


/* Str symbol() */
Str* Unit_symbol(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.symbol not implemented yet"));
}


/* Float scale() */
Float Unit_scale(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.scale not implemented yet"));
}


/* Float offset() */
Float Unit_offset(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.offset not implemented yet"));
}


/* Str definition() */
Str* Unit_definition(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.definition not implemented yet"));
}


/* Int kg() */
Int Unit_kg(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.kg not implemented yet"));
}


/* Int m() */
Int Unit_m(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.m not implemented yet"));
}


/* Int sec() */
Int Unit_sec(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.sec not implemented yet"));
}


/* Int K() */
Int Unit_K(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.K not implemented yet"));
}


/* Int A() */
Int Unit_A(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.A not implemented yet"));
}


/* Int mol() */
Int Unit_mol(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.mol not implemented yet"));
}


/* Int cd() */
Int Unit_cd(Unit* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.cd not implemented yet"));
}


/* Unit mult(Unit that) */
Unit* Unit_mult(Unit* self, Unit* that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.mult not implemented yet"));
}


/* Unit div(Unit b) */
Unit* Unit_div(Unit* self, Unit* b)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.div not implemented yet"));
}


/* Float convertTo(Float scalar, Unit unit) */
Float Unit_convertTo(Unit* self, Float scalar, Unit* unit)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Unit.convertTo not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Unit_initType(void)
{
  if (Unit_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Unit_initVTable();
    Type* type = Type_new("Unit", baseType, vtable, sizeof(Unit), sizeof(UnitVTable));
    Type_registerCtorImplementation(type, "make", Unit_make, 0);
    Type_registerMethodImplementation(type, "A", Unit_A, 0);
    Type_registerMethodImplementation(type, "K", Unit_K, 0);
    Type_registerMethodImplementation(type, "cd", Unit_cd, 0);
    Type_registerMethodImplementation(type, "convertTo", Unit_convertTo, 2);
    Type_registerMethodImplementation(type, "define", Unit_define, 1);
    Type_registerMethodImplementation(type, "definition", Unit_definition, 0);
    Type_registerMethodImplementation(type, "div", Unit_div, 1);
    Type_registerMethodImplementation(type, "equals", Unit_equals, 1);
    Type_registerMethodImplementation(type, "fromStr", Unit_fromStr_1, 1);
    Type_registerMethodImplementation(type, "fromStr", Unit_fromStr, 2);
    Type_registerMethodImplementation(type, "hash", Unit_hash, 0);
    Type_registerMethodImplementation(type, "ids", Unit_ids, 0);
    Type_registerMethodImplementation(type, "kg", Unit_kg, 0);
    Type_registerMethodImplementation(type, "list", Unit_list, 0);
    Type_registerMethodImplementation(type, "m", Unit_m, 0);
    Type_registerMethodImplementation(type, "mol", Unit_mol, 0);
    Type_registerMethodImplementation(type, "mult", Unit_mult, 1);
    Type_registerMethodImplementation(type, "name", Unit_name, 0);
    Type_registerMethodImplementation(type, "offset", Unit_offset, 0);
    Type_registerMethodImplementation(type, "quantities", Unit_quantities, 0);
    Type_registerMethodImplementation(type, "quantity", Unit_quantity, 1);
    Type_registerMethodImplementation(type, "scale", Unit_scale, 0);
    Type_registerMethodImplementation(type, "sec", Unit_sec, 0);
    Type_registerMethodImplementation(type, "symbol", Unit_symbol, 0);
    Type_registerMethodImplementation(type, "toStr", Unit_toStr, 0);
    Unit_classType = type;
    Unit_initStatic();
  }
  return Unit_classType;
}


VTable* Unit_initVTable(void)
{
  if (Unit_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(UnitVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->equals = Unit_equals;
    ((FanObjVTable*)vtable)->hash = Unit_hash;
    ((FanObjVTable*)vtable)->toStr = Unit_toStr;
    Unit_classVTable = vtable;
  }
  return Unit_classVTable;
}


void Unit_initStatic(void)
{
}
